﻿#region using
using System;
using Linq2Crm.ObjectModel.Attributes;
using SLApp_Test.Model;
using SilverCrmSoap.CrmSdk;

#endregion

namespace SLApp_Test
{
   [CrmEntityMapping("promx_activityrecord", "promx_activityrecorddescription", "promx_activityrecordid")]
   public class Booking : BaseEntity
   {
      [CrmFieldMapping("promx_duration")]
      public double? Duration { get; set; }

      [CrmFieldMapping("promx_start")]
      public DateTime? StartTime { get; set; }

      [CrmFieldMapping("promx_bookingstate")]
      public bookingstate BookingState { get; set; }

      [CrmFieldMapping("promx_stop")]
      public DateTime? EndTime { get; set; }

      [CrmFieldMapping("promx_details")]
      public string Description { get; set; }

      [CrmFieldMapping("promx_etc")]
      public double? ETC { get; set; }

      [CrmFieldMapping("promx_workbreak")]
      public double? Break { get; set; }

      [CrmFieldMapping("promx_projectlookup")]
      public Guid? ProjectId { get; set; }

      [CrmFieldMapping("promx_employeeinprojectlookup")]
      public Guid ProjectAssignmentId { get; set; }

      [CrmFieldMapping("promx_activityrecordtypeid")]
      public Guid? BookingTypeId { get; set; }

      [CrmFieldMapping("transactioncurrencyid")]
      public Guid? Currency { get; set; }

      [CrmFieldMapping("promx_hourlyrate")]
      public decimal? Hourlyrate { get; set; }

      [CrmFieldMapping("promx_hourlyrate_base")]
      public decimal? HourlyrateBase { get; set; }

      public double OriginalDuration { get; set; }

      [CrmFieldMapping("promx_fullday")]
      public bool? AllDay { get; set; }

      [CrmFieldMapping("promx_type")]
      public bookingtype BookingType { get; set; }

      [CrmFieldMapping("promx_invoiceid")]
      public EntityReference InvoiceReference { get; set; }
   }

   public enum bookingstate
   {
      booked = 596440000,
      closed = 596440001,
      approved = 596440002,
   }
}